import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        id: 0,
        ids: 0,
        lists: [],
        mountid: 0
    },
    mutations: {
        getid(state, id) {
            state.id = id
        },
        getids(state, val) {
            state.ids = val
        },
        getlist(state, val) {
            state.lists = val
        },
        result(state) {
            if (state.ids === 0) {
                return
            } else {
                let idss = state.ids * 1
                return state.lists = state.lists.filter(i => i.id === idss)
            }
        },
        moun(state, id) {
            state.mountid = id
        }


    },
    actions: {},
    modules: {}
})